package com.ztgf.order.api.client;

import com.ztgf.common.constant.Result;
import com.ztgf.order.models.service.IOrderStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author: chenyu.wang
 * date: 2020-07-31 17:26
 * Description: 订单统计控制器
 */
@RestController
@RequestMapping("/api/orderStatisticsApiController")
@Api(value = "OrderStatisticsApiController", tags = "订单统计api接口")
public class OrderStatisticsApiController {

    @DubboReference
    private IOrderStatisticsService orderStatisticsService;

    @PostMapping(value = "/queryStoreOrders")
    @ApiOperation(value = "卖家个人中心店铺信息订单量/销售额统计", notes = "卖家个人中心店铺信息订单量统计")
    public Result queryStoreOrders(Long shopId) {
        return new Result<>(orderStatisticsService.queryStoreOrders(shopId));
    }

    @PostMapping(value = "/queryShopViews")
    @ApiOperation(value = "卖家个人中心店铺浏览量统计", notes = "卖家个人中心店铺浏览量统计")
    public Result queryShopViews(Long shopId) {
        return new Result<>(orderStatisticsService.queryShopViews(shopId));
    }

}
